package _220311;

import java.util.TreeSet;

/**
 * @author ShadowLim
 * @create 2022-03-11-10:55
 */
public class _第几个幸运数字 {
    private static Long MAX = 59084709587505L;

    public static void main(String[] args) {
        long t = 1;
        int[] a = {3, 5, 7};
        TreeSet<Long> s = new TreeSet<>();  // 可以自动排序去重
        while (true) {
            for (int i = 0; i < a.length; i++) {
                Long tt = a[i] * t;
                if (tt <= MAX) {
                    s.add(tt);
                }
            }
            t = s.higher(t);    // TreeSet中选择比t大的最小数
            if (t >= MAX) {
                break;
            }
        }
        System.out.println(s.size());
    }
}
